package _5thread;

/**
 * @description:
 * @author: wang zhen
 * @create: 2022-09-16 16:08
 */
public class ThreadTest1 {


    public static void main(String[] args){

        new Thread(()->{

            lock1();
        },"t1").start();

        new Thread(()->{

            lock1();
        },"t2").start();

    }


    public static synchronized void lock1(){

        try {
            System.out.println(Thread.currentThread().getName()+"start...");
            Thread.sleep(2000);
            System.out.println(Thread.currentThread().getName()+"end...");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
